package http;

import java.io.IOException;

public class HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{

    }

    public void doPut(HttpServletRequest request, HttpServletResponse response) throws IOException{

    }

    public void doDelete(HttpServletRequest request, HttpServletResponse response) throws IOException{

    }

    public void service(HttpServletRequest request, HttpServletResponse response) throws IOException{
        switch (request.getMethod()){
            case "GET":
                doGet(request, response);
                break;
            case "POST":
                doPost(request,response);
                break;
            case  "PUT":
                doPut(request,response);
                break;
            case "DELETE":
                doDelete(request,response);
                break;
        }
    }

    //生命周期： 初始化
    public void init(){

    }

    //生命周期：销毁
    public void destroy(){

    }
}
